// pages/gr_xx1/gr_xx1.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var that = this;
      var ui_d = options.ui_d;
      app.globalData.shen_f = options.shen_f
      console.log(app.globalData.gl_id)
      that.setData({
        gl_id:app.globalData.gl_id,
        uida:app.globalData.uid,
        shen_f:app.globalData.shen_f
      })
      wx.request({
        url: app.globalData.url_l + 'api/member/lianxi_xinxi',
        method: 'post',
        data:{
            uid:app.globalData.uid,
            id:ui_d,
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: function (res) {
          console.log(res)
          
           that.setData({
             gr_xx:res.data,
             z_id:res.data.id
           })
        }
      })
  },
  shanchu:function(e){
    var u_id = e.currentTarget.dataset.id; 
    wx.request({
      url: app.globalData.url_l + 'api/member/kehu_delete',
      method: 'post',
      data:{
        khid:u_id,
        uid:app.globalData.uid
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
         if(res.data.code==1){

            wx.showModal({
              title: '',
              content: res.data.msg,
              showCancel: false,
              success:function(res){
                    if(res.confirm){
                       wx.navigateBack()
                    }else{
                       
                    }
              }
            })
         }else{
          wx.showModal({
            title: '',
            content: res.data.msg,
            showCancel: false,
            success:function(res){
                  if(res.confirm){
                     wx.navigateBack()
                  }else{
                     
                  }
            }
          })
         }
      }
    })
  },
  sz_gl:function(e){
    var u_id = e.currentTarget.dataset.id; 
    var stat = e.currentTarget.dataset.stat; 
    wx.request({
      url: app.globalData.url_l + 'api/member/mem_guanli',
      method: 'post',
      data:{
          uid:u_id,
          state:stat
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
         if(res.data.code==1){

          if(stat==1){
            wx.showModal({
              title: '',
              content: '设置成功!',
              showCancel: false,
              success:function(res){
                    if(res.confirm){
                       wx.navigateBack()
                    }else{
                       
                    }
              }
            })
          }else if(stat==2){
            wx.showModal({
              title: '',
              content: '解除成功!',
              showCancel: false,
              success:function(res){
                    if(res.confirm){
                       wx.navigateBack()
                    }else{
                       
                    }
              }
            })
          }
         }else{
          wx.showModal({
            title: '',
            content: '设置失败还没有实名认证!',
            showCancel: false,
            success:function(res){
                  if(res.confirm){
                     wx.navigateBack()
                  }else{
                     
                  }
            }
          })
         }
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})